<template>
  <div class="ttttt">
    <!-- 图标 -->
    <div class="imgaaa">
      <div />
    </div>
    <!-- 工具 -->
    <div class="gj">
      <!-- 第一个 -->
      <div>
        <!-- /通讯录 -->
        <van-icon
          name="friends-o"
          v-if="tongxunlu"
          style="font-size: 27px; margin-right: 20px"
        />

        <!-- 搜索框 -->
        <van-search
          class="ssk"
          v-model="sousuo"
          placeholder="请输入搜索关键词"
          shape="round"
          v-if="sousuokuang"
        />
      </div>
      <!-- 第二个 -->
      <div>
        <!-- 工具 -->
        <van-icon
          name="add-o"
          v-if="qitagongjv"
          style="font-size: 27px; margin-right: 20px"
        />

        <!-- 积分 -->
        <div class="jifeng" v-if="jifneg">
          <span style="font-size: 10px">积分</span>
          <span style="font-size: 20px">{{
            this.$store.state.userData.integral || 0
          }}</span>
        </div>
      </div>

      <!-- 第三个 -->
      <div class="wode" @click="jrwode">
        <!-- 我的 -->
        <span>我</span>
        <span>的</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Title",
  data() {
    return {
      sousuo: "",
    };
  },
  methods: {
    jrwode() {
      this.$router.push("/my").catch((r) => {});
    },
  },
  computed: {
    // 哪几个页面显示搜索框
    sousuokuang() {
      let arr = ["/bailing", "/home", "/dianshitai", "/diantai"];
      if (arr.includes(this.$route.path)) return true;
      return false;
    },
    // 哪几个页面显示积分
    jifneg() {
      let arr = ["/bailing", "/home", "/dianshitai", "/diantai"];
      if (arr.includes(this.$route.path)) return true;
      return false;
    },
    // 哪几个页面显示通讯录
    tongxunlu() {
      let arr = ["/qiangguotong"];
      if (arr.includes(this.$route.path)) return true;
      return false;
    },
    // 哪几个页面显示其他工具
    qitagongjv() {
      let arr = ["/qiangguotong"];
      if (arr.includes(this.$route.path)) return true;
      return false;
    },
  },
};
</script>

<style scoped>
.ttttt {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  background-color: rgb(226, 25, 25);
  color: #ffffff;
  width: 100vw;
  height: 6vh;
}
.gj {
  font-size: 25px;
  width: calc(100% - 120px);
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  margin-right: 20px;
  font-size: 17px;
}
.ssk {
  background: transparent;
  /* width: 70%; */
}

.jifeng {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  margin: 0 5px;
}
.imgaaa {
  width: 30%;
  height: 100%;
}

.imgaaa > div {
  width: 100%;
  height: 100%;
  background-image: url("https://img2.baidu.com/it/u=2053363257,2850220013&fm=253&fmt=auto&app=120&f=PNG?w=605&h=293");
  background-size: 170%;
  background-position: 15% 40%;
}
.wode {
  display: flex;
  flex-direction: row;
  font-size: 20px;
}
</style>